package com.weijian.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.weijian.dal.entity.Shipment;
import com.weijian.mapper.ShipmentMapper;
import com.weijian.service.ShipmentService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 货物服务实现类
 */
@Service
public class ShipmentServiceImpl extends ServiceImpl<ShipmentMapper, Shipment> implements ShipmentService {
    
    @Override
    public List<Shipment> searchShipments(Integer originNode, Integer destinationNode) {
        return this.lambdaQuery()
                .eq(originNode != null, Shipment::getOriginNode, originNode)
                .eq(destinationNode != null, Shipment::getDestinationNode, destinationNode)
                .list();
    }
    
    @Override
    public Shipment getShipmentById(Integer id) {
        return this.getById(id);
    }
    
    @Override
    public List<Shipment> getShipmentsByDataId(Integer dataId) {
        return this.lambdaQuery()
                .eq(Shipment::getDataId, dataId)
                .list();
    }
}